package hu.u_szeged.inf.ovrt.filelister.core.beans;

import java.io.File;
import java.util.ArrayList;
import java.util.List;

/**
 * Application state class.
 */
public class ApplicationState {
    private File file;
    private List<String> filters;

    /**
     * Default constructor.
     */
    public ApplicationState() {
        this.file = new File(System.getProperty("user.dir"));
        this.filters = new ArrayList<String>();
    }

    /**
     * File parametrised constructor.
     *
     * @param file {@link File}
     */
    public ApplicationState(File file) {
        this.file = file;
    }

    public File getFile() {
        return file;
    }

    public void setFile(File file) {
        this.file = file;
    }

    public List<String> getFilters() {
        return filters;
    }

    /**
     * Method to add filter.
     *
     * @param filter regular expression.
     */
    public void addFilter(String filter) {
        filters.add(filter);
    }

    /**
     * Method to delete filter.
     *
     * @param filter regular expression.
     */
    public void delFilter(String filter) {
        if (filters.contains(filter)) {
            filters.remove(filters.indexOf(filter));
        }
    }
}
